package com.lc.sell.vo;

import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 统一返回类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "结果统一返回处理类")
public class ResultVo {

    private Integer code;

    private String msg;

    private Object data;

    public static ResultVo ok(String msg){
        return new ResultVo(200,msg,null);
    }

    public static ResultVo ok(String msg,Object data){
        return new ResultVo(200,msg,data);
    }

    public static ResultVo ok(Integer code,String msg,Object data){
        return new ResultVo(code,msg,data);
    }

    public static ResultVo fail(String msg){
        return new ResultVo(400,msg,null);
    }

    public static ResultVo fail(String msg,Object data){
        return new ResultVo(400,msg,data);
    }

    public static ResultVo fail(Integer code,String msg,Object data){
        return new ResultVo(code,msg,data);
    }
}
